package apptoko.com.validator.validator;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.content.Context;
import apptoko.com.validator.AbstractValidator;

import apptoko.com.R;
;

public class PasswordUsernameSpecialCharacterValidator extends AbstractValidator {
	
	private int mErrorMessage = R.string.validator_password_special_character;
	
	
	public PasswordUsernameSpecialCharacterValidator(Context c) {
		super(c);
	}
	
	@Override
	public boolean isValid(String value) {
		Pattern p = Pattern.compile("[^a-z0-9]", Pattern.CASE_INSENSITIVE);
		Matcher m = p.matcher(value);
		return m.find();
	}

	@Override
	public String getMessage() {
		return mContext.getString(mErrorMessage);
	}

}
